<?php

class Rcp_Methods_Request_GetLectures {
	
	/**
	 *
	 * @var Rcp_Methods_Data_App
	 */
	public $app;
	
	public function __construct($params) {
		$this->app = new Rcp_Methods_Data_App($params->app);
	}
	
	public function process() {
      $user = Rcp_Auth::getInstance()->getUser();
      if (!$user->isLecture())
        throw new Rcp_Exception_App(Rcp_Exception_Codes::USER_HAS_NOT_LECTURE);

      $lectures = RcpLecturesQuery::create()
              ->leftJoinLecutreHourDefs()
              ->filterByUsers($user)
              ->with('LecutreHourDefs')
              ->find();
      
      return new Rcp_Methods_Response_GetLectures($lectures);
	}
	
}